﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

/// <summary>
///SessionManager 的摘要说明
/// </summary>
public class SessionManager
{
    /// <summary>
    /// 是否登录
    /// </summary>
    public static bool IsLogined
    {
        get
        {
            return CurrentUser != null;
        }
    }

    /// <summary>
    /// 当前登录用户
    /// </summary>
    public static User CurrentUser
    {
        get
        {
            if (System.Web.HttpContext.Current.Session["CurrentUser"] == null)
            {
                return null;
            }

            return (User)System.Web.HttpContext.Current.Session["CurrentUser"];
        }
        set
        {
            System.Web.HttpContext.Current.Session["CurrentUser"] = value;
        }
    }
}